var modalDT;
var orgId = 0;
var orgDataFlag = 0;
var roadPoleJsonData;
var roadSignCollectFlag = 0;
var nowRoadPoleId = 0;          //用于删除选择
var ggRoadPoleId = 0;           //用于modal选择
var fileUrl;
var switchPic = 0;
$(function () {
    gMainDT = $("#mainDataTables").DataTable({
        ajax: {
            url: "../rds_roadSignAudit/getRoadPoleAudit4DT",
            type: "POST",
            data: function (d) {
                d.search = $('#mainDataTables').DataTable().search(this.value);
                d.orgId = gUserLoginResult.orgId;
                d.actorIds = gUserLoginResult.userActors;
            }
        },
        columns: [{
            data: "roadPoleId",
            render: function (data, type, row, meta) {
                var checkId = "checkbox" + (parseInt(meta.row) + 1);
                return "<input type='checkbox' value='" + data + "' id='" + checkId + "'>";
            }
        }, {
            data: null,
            targets: 0
        }, {
            data: "roadPolePic",
            render: function (data, type, row) {
                return "<img src='" + data + "'  style='width:50px;height:40px;cursor: pointer' " +
                    "onclick='$.showPicModal(\"" + data + "\")'> ";
            }
        }, {
            data: null,
            render: function (data, type, row) {
                return row.province + " " + row.city + " " + row.area;
            }
        }, {
            data: "roadName"
        }, {
            data: "roadPoleBridge",
            render: function (data, type, row) {
                var roadPoleBridge = "否";
                if (data == 0)
                    roadPoleBridge = "是";
                return roadPoleBridge;
            }
        }, {
            data: "roadPoleSecurity",
            render: function (data, type, row) {
                var roadPoleSecurity = "安全";
                if (row.roadPoleSecurity != 0) {
                    roadPoleSecurity = "不安全";
                }
                return roadPoleSecurity;
            }
        }, {
            data: "orgName"
        }, {
            data: "userName"
        }, {
            data: "roadPoleCreateTime",
            render: function (data, type, row) {
                return data.substring(0, 10);
            }
        },
            {
                data: "roadPoleId",
                render: function (data, type, row) {
                    nowRoadPoleId = data;
                    return "<button class='btn btn-primary btn-xs btn-flat' id='view-Signs' " +
                        "onclick='$.getRoadSignByRoadPoleIdModal(" + JSON.stringify(row) + "," + data + ")'>查看标牌</button> " +
                        "<button class='btn btn-primary btn-xs btn-flat' onclick='$.getAllInformation(" + JSON.stringify(row) + ")' title='预览'>" +
                        "<i class='glyphicon glyphicon-eye-open'></i></button>";
                }
            },
            {
                data: "roadPoleIsComplete",
                render: function (data, type, row) {
                    var buttonOperation = "";
                    var gNowRoadPoleId = nowRoadPoleId;
                    var auditStatu = 0;
                    var buttonUpdate = "<button class='btn btn-primary btn-xs btn-flat' " +
                        "onclick='$.updateRoadPoleCollectModal(" + JSON.stringify(row) + ")' title='查看标杆'>" +
                        "<i class='glyphicon glyphicon-eye-open'></i></button>";
                    var buttonDelete = "<button class='btn btn-primary btn-xs btn-flat' " +
                        "onclick='$.deleteRoadPoleCollect(" + gNowRoadPoleId + ")' title='删除'>" +
                        "<i class='fa fa-minus-square'></i></button>";
                    var buttonAudit = "<button class='btn btn-primary btn-xs btn-flat' id='audit-Signs' " +
                        "onclick='$.getRoadSignByRoadPoleIdModal(" + JSON.stringify(row) + "," + auditStatu + ")' title='审核'>" +
                        "<i class='glyphicon glyphicon-check'></i></button>";
                    if (data == 0)
                        buttonOperation += buttonAudit + " ";
                    gUpdate == 0 ? buttonOperation : buttonOperation += buttonUpdate + " ";
                    gDelete == 0 ? buttonOperation : buttonOperation += buttonDelete;
                    buttonOperation == "" ? buttonOperation = "无权限" : buttonOperation;
                    return buttonOperation;
                }
            }],
        dom: "<'row'<'col-md-4'l><'#mainToolbar.col-md-8'>r>t<'row'<'col-md-6'i><'col-md-6'p>>",
        initComplete: function () {
            // 下拉工具栏按钮的权限
            $("#mainToolbar").empty();
            var strToolBar = "<div class='pull-right'><div class='btn-group'>" +
                "<button type='button' class='btn btn-primary btn-sm btn-flat'><i class='fa fa-cog'></i> 操作</button>" +
                "<button type='button' class='btn btn-primary btn-sm btn-flat dropdown-toggle' " +
                "data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>" +
                "<span class='caret'></span><span class='sr-only'>切换下拉</span></button>" +
                "<ul class='dropdown-menu'>" +
                "<li>" +
                "<button href='#' class='btn btn-primary btn-sm btn-flat btn-block' " +
                "onclick='gMainDT.ajax.reload(null, false);'><i class='fa fa-refresh'></i> 刷新</button>" +
                "</li>";

            // var buttonAdd = "<li><button href='#' class='btn btn-primary btn-sm btn-flat btn-block' " +
            //     "onclick='$.addRoadPoleCollectModal()'><i class='fa fa-plus-square'></i> 添加</button></li>";
            // gInsert == 0 ? strToolBar : strToolBar += buttonAdd;
            var buttonAudit = "<li><button href='#' class='btn btn-primary btn-sm btn-flat btn-block' " +
                "onclick='$.RoadPoleAudit(0)'><i class='glyphicon glyphicon-check'></i> 审核</button></li>";
            var buttonDelete = "<li><button href='#' class='btn btn-primary btn-sm btn-flat btn-block' " +
                "onclick='$.deleteRoadPoleCollect(0)'><i class='fa fa-minus-square'></i> 删除</button></li>";
            strToolBar += buttonAudit;
            gDelete == 0 ? strToolBar : strToolBar += buttonDelete;

            strToolBar += "</ul></div> " +
                "<div class='input-group input-group-sm'>" +
                "<input type='text' class='form-control' id='searchText' placeholder='路名'>" +
                "<span class='input-group-btn'>" +
                "<button class='btn btn-primary btn-flat' type='button' onclick='$(this).searchDT()'>" +
                "<i class='fa fa-search'></i></button></span></div></div>";
            $("#mainToolbar").append(strToolBar);
        },
        processing: true,
        serverSide: true,
        ordering: false,
        select: false,
        autoFill: true,
        displayLength: 20,
        lengthMenu: [[5, 10, 15, 20, 50, 100, 150, -1], [5, 10, 15, 20, 50, 100, 150, "All"]],
        language: {
            url: "zh_cn.json"
        },
        fnDrawCallback: function () {// 序号自增回调函数
            var api = this.api();
            var startIndex = api.context[0]._iDisplayStart;
            api.column(1).nodes().each(function (cell, i) {
                cell.innerHTML = startIndex + i + 1;
            });
        }
    });
    $("input").attr("readonly", true);
    $("select").attr("disabled", true);
});

$.fn.searchDT = function () {
    gMainDT.search($("#searchText").val()).draw();
};

$.checkChange = function () {
    var isChecked = $("#batchCheck").prop('checked');
    $("input:checkbox[id^='checkbox']").prop("checked", isChecked);
};


$.getMainOrgNameAndId = function (id) {
    $.ajax({
        url: "../rds_org/getMainOrgNameAndId",
        type: 'post',
        async: false,
        dataType: 'json',
        data: {
            'orgId': gUserLoginResult.orgId
        },
        success: function (msg) {
            if (msg != null && typeof (msg) != "undefined") {
                if (msg.isSuccess == true) {
                    var orgData = msg.jsonData;
                    $("#" + id).empty();
                    if (orgData.length != 0) {
                        orgDataFlag = 0;
                        for (var i = 0; i < orgData.length; i++)
                            $("#" + id).append("<option value='" + orgData[i].orgId + "'>" +
                                orgData[i].orgName + "</option>");
                    }
                    else {
                        orgDataFlag = 1;
                        $("#" + id).append("<option value='" + gUserLoginResult.orgId + "'>" +
                            gUserLoginResult.orgName + "</option>");
                    }
                } else {
                    $.alert("获取监管单位数据失败", 2);
                }
            } else {
                $.alert('系统错误', 2);
            }
        },
        error: function () {
            $.alert("系统错误", 2);
        }
    });
};

$.updateRoadPoleCollectModal = function (jsonData) {
    switchPic = 0;
    $.getMainOrgNameAndId("mainOrgIdUpdate");
    $("#projectNumberUpdate").val(jsonData.projectNumber);
    $("#roadPoleIdUpdate").val(jsonData.roadPoleId);
    $("#provinceUpdate").val(jsonData.province);
    $("#cityUpdate").val(jsonData.city);
    $("#areaUpdate").val(jsonData.area);
    $("#orgIdUpdate").val(jsonData.orgName);
    $("#createUserNameUpdate").val(jsonData.userName);
    $("#coordinate").val(jsonData.longitude + "," + jsonData.latitude);
    $("#roadNameUpdate").val(jsonData.roadName);
    $("#startRoadUpdate").val(jsonData.startRoad);
    $("#endRoadUpdate").val(jsonData.endRoad);
    if (orgDataFlag == 0)
        $("#mainOrgIdUpdate").val(jsonData.mainOrgId);
    else
        $("#mainOrgIdUpdate").val(gUserLoginResult.orgId);
    $("#roadPolePicUpdate").attr("src", jsonData.roadPolePic);
    $("#roadPoleSecurityUpdate").val(jsonData.roadPoleSecurity);
    $("#roadPoleBridgeUpdate").val(jsonData.roadPoleBridge);
    $("#roadPoleShapeUpdate").val(jsonData.roadPoleShape);
    $.changeRoadPoleSizeUpdate(jsonData.roadPoleSize);
    $("#updateRoadPoleCollectLabel").text("查看标杆信息");
    $("#updateRoadPoleCollectModal").modal({
        backdrop: 'static',
        keyboard: false,
        show: true
    });
};
$("#roadPolePicUpdate").click(function () {
    $.showPicModal($(this).attr("src"));
});
$.changeRoadPoleSizeUpdate = function (roadPoleSize) {
    $("#roadPoleSizeUpdate").empty();
    switch ($("#roadPoleShapeUpdate").val()) {
        case '0':
            $("#roadPoleSizeUpdate").append("<option value='0'>直径*高度: 80*1000</option>");
            $("#roadPoleSizeUpdate").append("<option value='1'>直径*高度: 80*1500</option>");
            $("#roadPoleSizeUpdate").append("<option value='2'>直径*高度: 80*2000</option>");
            break;
        case '1':
            $("#roadPoleSizeUpdate").append("<option value='0'>直径*高度: 80*1000</option>");
            $("#roadPoleSizeUpdate").append("<option value='1'>直径*高度: 80*1500</option>");
            $("#roadPoleSizeUpdate").append("<option value='2'>直径*高度: 80*2000</option>");
            break;
        case '2':
            $("#roadPoleSizeUpdate").append("<option value='0'>挑臂长*高度: 300*5500</option>");
            break;
        case '3':
            $("#roadPoleSizeUpdate").append("<option value='0'>挑臂长*高度: 300*1500</option>");
            $("#roadPoleSizeUpdate").append("<option value='1'>挑臂长*高度: 300*2500</option>");
            $("#roadPoleSizeUpdate").append("<option value='2'>挑臂长*高度: 300*5500</option>");
            break;
        case '4':
            $("#roadPoleSizeUpdate").append("<option value='0'>挑臂长*高度: 300*5500</option>");
            break;
        case '5':
            $("#roadPoleSizeUpdate").append("<option value='0'>挑臂长*高度: 300*5500</option>");
            break;
        case '6':
            $("#roadPoleSizeUpdate").append("<option value='0'>跨度*高度: 300*5500</option>");
            break;
    }
    $("#roadPoleSizeUpdate").val(roadPoleSize);
};

$("#roadPoleShapeUpdate").change(function () {
    $.changeRoadPoleSizeUpdate(0);
});

$('#updateRoadPoleCollectForm').bootstrapValidator({
    feedbackIcons: {
        valid: 'glyphicon glyphicon-ok',
        invalid: 'glyphicon glyphicon-remove',
        validating: 'glyphicon glyphicon-refresh'
    },
    fields: {
        areaUpdate: {
            validators: {
                notEmpty: {message: '区/县名不能为空'},
                stringLength: {max: 50, message: '区/县名长度不超过50'}
            }
        },
        longitudeUpdate: {
            validators: {
                notEmpty: {message: '经度不能为空'},
                stringLength: {max: 20, message: '经度长度不超过20'}
            }
        },
        latitudeUpdate: {
            validators: {
                notEmpty: {message: '纬度不能为空'},
                stringLength: {max: 20, message: '纬度长度不超过20'}
            }
        },
        roadNameUpdate: {
            validators: {
                notEmpty: {message: '路名不能为空'},
                stringLength: {max: 50, message: '路名长度不超过50'}
            }
        },
        startRoadUpdate: {
            validators: {
                notEmpty: {message: '起始路口不能为空'},
                stringLength: {max: 50, message: '路名长度不超过50'}
            }
        },
        endRoadUpdate: {
            validators: {
                notEmpty: {message: '结束路口不能为空'},
                stringLength: {max: 50, message: '路名长度不超过50'}
            }
        },
        roadPoleSecurityUpdate: {
            validators: {
                notEmpty: {message: '安全状况不能为空'}
            }
        },
        roadPoleBridgeUpdate: {
            validators: {
                notEmpty: {message: '是否桥上不能为空'}
            }
        },
        mainOrgIdUpdate: {
            validators: {
                notEmpty: {message: '监管单位不能为空'}
            }
        },
        roadPoleShapeUpdate: {
            validators: {
                notEmpty: {message: '标杆形状不能为空'}
            }
        },
        roadPoleSizeUpdate: {
            validators: {
                notEmpty: {message: '标杆大小不能为空'}
            }
        }
    }
}).on('success.form.bv', function (e) {
    e.preventDefault();
    $.ajax({
        url: "../rds_roadSignManageController/updateRoadPoleCollect",
        type: 'post',
        data: {
            roadPoleId: $("#roadPoleIdUpdate").val(),
            area: $("#areaUpdate").val(),
            longitude: $("#longitudeUpdate").val(),
            latitude: $("#latitudeUpdate").val(),
            roadName: $("#roadNameUpdate").val(),
            startRoad: $("#startRoadUpdate").val(),
            endRoad: $("#endRoadUpdate").val(),
            mainOrgId: $("#mainOrgIdUpdate").val(),
            roadPoleSecurity: $("#roadPoleSecurityUpdate").val(),
            roadPoleBridge: $("#roadPoleBridgeUpdate").val(),
            roadPoleShape: $("#roadPoleShapeUpdate").val(),
            roadPoleSize: $("#roadPoleSizeUpdate").val(),
            roadPolePic: $("#roadPolePicUpdate").attr("src")
        },
        dataType: 'json',
        success: function (msg) {
            if (msg != null && typeof (msg) != "undefined") {
                if (msg.isSuccess == true) {
                    $.alert("数据操作成功", 1);
                    gMainDT.ajax.reload(null, false);
                } else {
                    $.alert("数据操作失败", 2);
                }
            } else {
                $.alert('系统错误，请联系管理员', 2);
            }
        },
        error: function () {
            $.alert('系统错误，请联系管理员', 2);
        }
    });
    $('#updateRoadPoleCollectModal').modal('hide');
});


$.addRoadPoleCollectModal = function () {
    switchPic = 1;
    $.getMainOrgNameAndId("mainOrgIdAdd");
    $("#orgIdAdd").val(gUserLoginResult.orgName);
    $("#createUserNameAdd").val(gUserLoginResult.userName);
    $("#roadPolePicAdd").attr("src", "../images/default_photo.png");
    $("#roadPoleSecurityAdd").val(0);
    $("#roadPoleBridgeAdd").val(0);
    $("#roadPoleShapeAdd").val(0);
    $.changeRoadPoleSizeAdd();
    $("#addRoadPoleCollectLabel").text("添加标杆信息");
    $("#addRoadPoleCollectModal").modal({
        backdrop: 'static',
        keyboard: false,
        show: true
    });
};

$.changeRoadPoleSizeAdd = function () {
    $("#roadPoleSizeAdd").empty();
    switch ($("#roadPoleShapeAdd").val()) {
        case '0':
            $("#roadPoleSizeAdd").append("<option value='0'>直径*高度: 80*1000</option>");
            $("#roadPoleSizeAdd").append("<option value='1'>直径*高度: 80*1500</option>");
            $("#roadPoleSizeAdd").append("<option value='2'>直径*高度: 80*2000</option>");
            break;
        case '1':
            $("#roadPoleSizeAdd").append("<option value='0'>直径*高度: 80*1000</option>");
            $("#roadPoleSizeAdd").append("<option value='1'>直径*高度: 80*1500</option>");
            $("#roadPoleSizeAdd").append("<option value='2'>直径*高度: 80*2000</option>");
            break;
        case '2':
            $("#roadPoleSizeAdd").append("<option value='0'>挑臂长*高度: 300*5500</option>");
            break;
        case '3':
            $("#roadPoleSizeAdd").append("<option value='0'>挑臂长*高度: 300*1500</option>");
            $("#roadPoleSizeAdd").append("<option value='1'>挑臂长*高度: 300*2500</option>");
            $("#roadPoleSizeAdd").append("<option value='2'>挑臂长*高度: 300*5500</option>");
            break;
        case '4':
            $("#roadPoleSizeAdd").append("<option value='0'>挑臂长*高度: 300*5500</option>");
            break;
        case '5':
            $("#roadPoleSizeAdd").append("<option value='0'>挑臂长*高度: 300*5500</option>");
            break;
        case '6':
            $("#roadPoleSizeAdd").append("<option value='0'>跨度*高度: 300*5500</option>");
            break;
    }
    $("#roadPoleSizeAdd").val(0);
};

$("#roadPoleShapeAdd").change(function () {
    $.changeRoadPoleSizeAdd();
});

$('#addRoadPoleCollectForm').bootstrapValidator({
    feedbackIcons: {
        valid: 'glyphicon glyphicon-ok',
        invalid: 'glyphicon glyphicon-remove',
        validating: 'glyphicon glyphicon-refresh'
    },
    fields: {
        provinceAdd: {
            validators: {
                notEmpty: {message: '省名不能为空'},
                stringLength: {max: 50, message: '省名长度不超过50'}
            }
        },
        cityAdd: {
            validators: {
                notEmpty: {message: '市名不能为空'},
                stringLength: {max: 50, message: '市名长度不超过50'}
            }
        },
        areaAdd: {
            validators: {
                notEmpty: {message: '区/县名不能为空'},
                stringLength: {max: 50, message: '区/县名长度不超过50'}
            }
        },
        longitudeAdd: {
            validators: {
                notEmpty: {message: '经度不能为空'},
                stringLength: {max: 20, message: '经度长度不超过20'}
            }
        },
        latitudeAdd: {
            validators: {
                notEmpty: {message: '纬度不能为空'},
                stringLength: {max: 20, message: '纬度长度不超过20'}
            }
        },
        roadNameAdd: {
            validators: {
                notEmpty: {message: '路名不能为空'},
                stringLength: {max: 50, message: '路名长度不超过50'}
            }
        },
        startRoadAdd: {
            validators: {
                notEmpty: {message: '起始路口不能为空'},
                stringLength: {max: 50, message: '路名长度不超过50'}
            }
        },
        endRoadAdd: {
            validators: {
                notEmpty: {message: '结束路口不能为空'},
                stringLength: {max: 50, message: '路名长度不超过50'}
            }
        },
        roadPoleSecurityAdd: {
            validators: {
                notEmpty: {message: '安全状况不能为空'}
            }
        },
        roadPoleBridgeAdd: {
            validators: {
                notEmpty: {message: '是否桥上不能为空'}
            }
        },
        mainOrgIdAdd: {
            validators: {
                notEmpty: {message: '监管单位不能为空'}
            }
        },
        roadPoleShapeAdd: {
            validators: {
                notEmpty: {message: '标杆形状不能为空'}
            }
        },
        roadPoleSizeAdd: {
            validators: {
                notEmpty: {message: '标杆大小不能为空'}
            }
        }
    }
}).on('success.form.bv', function (e) {
    e.preventDefault();
    $.ajax({
        url: "../rds_roadSignManageController/addRoadPoleCollect",
        type: 'post',
        data: {
            roadPoleId: $("#roadPoleIdAdd").val(),
            province: $("#provinceAdd").val(),
            city: $("#cityAdd").val(),
            area: $("#areaAdd").val(),
            orgId: gUserLoginResult.orgId,
            createUserId: gUserLoginResult.userId,
            longitude: $("#longitudeAdd").val(),
            latitude: $("#latitudeAdd").val(),
            roadName: $("#roadNameAdd").val(),
            startRoad: $("#startRoadAdd").val(),
            endRoad: $("#endRoadAdd").val(),
            mainOrgId: $("#mainOrgIdAdd").val(),
            roadPoleSecurity: $("#roadPoleSecurityAdd").val(),
            roadPoleBridge: $("#roadPoleBridgeAdd").val(),
            roadPoleShape: $("#roadPoleShapeAdd").val(),
            roadPoleSize: $("#roadPoleSizeAdd").val(),
            roadPolePic: $("#roadPolePicAdd").attr("src")
        },
        dataType: 'json',
        success: function (msg) {
            if (msg != null && typeof (msg) != "undefined") {
                if (msg.isSuccess == true) {
                    $.alert("数据操作成功", 1);
                    gMainDT.ajax.reload(null, false);
                } else {
                    $.alert("数据操作失败", 2);
                }
            } else {
                $.alert('系统错误，请联系管理员', 2);
            }
        },
        error: function () {
            $.alert('系统错误，请联系管理员', 2);
        }
    });
    $.clearModal($("#addRoadPoleCollectForm"), $("#addRoadPoleCollectModal"));
});

$.deleteRoadPoleCollect = function (roadPoleIds) {
    var count = 1;
    if (roadPoleIds == 0) {
        count = $("input:checkbox[id^='checkbox']:checked").length;
        if (count == 0) {
            $.alert("请选择要删除的数据", 2);
            return;
        } else {
            roadPoleIds = "";
            $("input:checkbox[id^='checkbox']:checked").each(function () {
                roadPoleIds += $(this).val() + ",";
            });
            roadPoleIds = roadPoleIds.substring(0, roadPoleIds.length - 1);
        }
    }
    bootbox.confirm({
        buttons: {
            confirm: {
                label: '<i class="fa fa-check"></i> 确定',
                className: 'btn btn-primary btn-flat'
            },
            cancel: {
                label: '<i class="fa fa-close"></i> 取消',
                className: 'btn btn-warning btn-flat pull-left'
            }
        },
        message: '<i class="fa fa-question-circle-o"></i> <b class="customer-title">确定删除该' + count + '条数据吗?</b>',
        callback: function (result) {
            if (result) {
                $.ajax({
                    url: '../rds_roadSignManageController/deleteRoadPoleCollect',
                    type: 'post',
                    dataType: 'json',
                    data: {
                        "roadPoleIds": roadPoleIds
                    },
                    success: function (msg) {
                        if (msg != null && typeof (msg) != "undefined") {
                            if (msg.isSuccess == true) {
                                if (msg.jsonData == 0) {
                                    $.alert("数据删除成功", 1);
                                    gMainDT.ajax.reload(null, false);
                                } else {
                                    $.alert("数据删除失败，请先删除本标杆上的标牌", 2);
                                }
                            } else {
                                $.alert("数据删除失败", 2);
                            }
                        } else {
                            $.alert('系统错误，请联系管理员', 2);
                        }
                    },
                    error: function () {
                        $.alert('系统错误，请联系管理员', 2);
                    }
                });
            }
        }
    });
};

$.getRoadSignByRoadPoleIdModal = function (jsonData, auditStatus) {
    ggRoadPoleId = jsonData.roadPoleId;
    roadPoleJsonData = jsonData;
    modalDT = $("#modalDataTables").DataTable({
        ajax: {
            url: "../rds_roadSignAudit/getRoadSignAudit4DT",
            type: "POST",
            data: function (d) {
                d.search = $('#modalDataTables').DataTable().search(this.value);
                d.roadPoleId = jsonData.roadPoleId;
            }
        },
        columns: [{
            data: "roadSignId",
            targets: 0
        }, {
            data: "roadSignPic",
            render: function (data, type, row) {
                return "<img src='" + data + "' style='width:50px;height:40px;cursor: pointer' " +
                    "onclick='$.showPicModal(\"" + data + "\")'> ";
            }
        }, {
            data: "roadSignType",
            render: function (data, type, row) {
                var roadSignType = "";
                switch (data) {
                    case 0:
                        roadSignType = "警告标志";
                        break;
                    case 1:
                        roadSignType = "禁令标志";
                        break;
                    case 2:
                        roadSignType = "指示标志";
                        break;
                    case 3:
                        roadSignType = "指路标志";
                        break;
                    case 4:
                        roadSignType = "旅游标志";
                        break;
                    case 5:
                        roadSignType = "辅助标志";
                        break;
                    case 6:
                        roadSignType = "作业标志";
                        break;
                    case 7:
                        roadSignType = "告示标志";
                        break;
                }
                return roadSignType;
            }
        }, {
            data: "roadSignSecurity",
            render: function (data, type, row) {
                var roadSignSecurity = "安全";
                if (data != 0) {
                    roadSignSecurity = "不安全";
                }
                return roadSignSecurity;
            }
        }, {
            data: "roadSignBug",
            render: function (data, type, row) {
                var roadSignBug = "";
                switch (data) {
                    case 0:
                        roadSignBug = "正常";
                        break;
                    case 1:
                        roadSignBug = "膜脱落";
                        break;
                    case 2:
                        roadSignBug = "膜淡化";
                        break;
                    case 3:
                        roadSignBug = "逆反射系数不达标";
                        break;
                    case 4:
                        roadSignBug = "卷边";
                        break;
                    case 5:
                        roadSignBug = "转向";
                        break;
                    case 6:
                        roadSignBug = "非国际";
                        break;
                    case 7:
                        roadSignBug = "抱箍缺少";
                        break;
                    case 8:
                        roadSignBug = "净空高不达标";
                        break;
                    case 9:
                        roadSignBug = "设置不合理";
                        break;
                    case 10:
                        roadSignBug = "缺失";
                        break;
                    case 11:
                        roadSignBug = "建议增设";
                        break;
                    case 12:
                        roadSignBug = "与交通组织矛盾";
                        break;
                    case 13:
                        roadSignBug = "内容有误";
                        break;
                    case 14:
                        roadSignBug = "标牌与标杆不配套";
                        break;
                    case 15:
                        roadSignBug = "非公指示牌";
                        break;
                }
                return roadSignBug;
            }
        }, {
            data: "roadSignInstallTime",
            render: function (data, type, row) {
                return data.substring(0, 10);
            }
        }, {
            data: "defectsLiabilityPeriod",
            render: function (data, type) {
                return data + "年";
            }
        }, {
            data: "serviceLife",
            render: function (data, type) {
                return data + "年";
            }
        }, {
            data: "userName"
        }, {
            data: "roadSignId",
            render: function (data, type, row) {
                var buttonOperation = "";
                var buttonUpdate = "<button class='btn btn-primary btn-xs btn-flat' " +
                    "onclick='$.updateRoadSignCollectModal(" + JSON.stringify(row) + ")' title='查看标杆'>" +
                    "<i class='glyphicon glyphicon-eye-open'></i></button>";
                var buttonDelete = "<button class='btn btn-primary btn-xs btn-flat' " +
                    "onclick='$.deleteRoadSignCollect(" + data + ")' title='删除'>" +
                    "<i class='fa fa-minus-square'></i></button>";
                var buttonAudit = "<button class='btn btn-primary btn-xs btn-flat' id='audit-Signs' " +
                    "onclick='$.roadSignAuditById(" + JSON.stringify(row) + ")' title='审核标牌'>" +
                    "<i class='glyphicon glyphicon-check'></i></button>";
                if (auditStatus == 0) {
                    buttonOperation += buttonAudit + " ";
                }

                gUpdate == 0 ? buttonOperation : buttonOperation += buttonUpdate + " ";
                gDelete == 0 ? buttonOperation : buttonOperation += buttonDelete;
                buttonOperation == "" ? buttonOperation = "无权限" : buttonOperation;
                return buttonOperation;
            }
        }],
        dom: "<'row'<'col-md-6'><'#modalToolbar.col-md-6'>r>t<'row'>",
        initComplete: function () {
            $("#modalToolbar").empty();
            var strToolBar = "<div class='pull-right'><div class='btn-group'>" +
                "<button type='button' class='btn btn-primary btn-sm btn-flat'><i class='fa fa-cog'></i> 操作</button>" +
                "<button type='button' class='btn btn-primary btn-sm btn-flat dropdown-toggle' " +
                "data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>" +
                "<span class='caret'></span><span class='sr-only'>切换下拉</span></button>" +
                "<ul class='dropdown-menu'>" +
                "<li>" +
                "<button href='#' class='btn btn-primary btn-sm btn-flat btn-block' " +
                "onclick='modalDT.ajax.reload(null, false);'><i class='fa fa-refresh'></i> 刷新</button>" +
                "</li>";

            // var buttonAdd = "<li><button href='#' class='btn btn-primary btn-sm btn-flat btn-block' " +
            //     "onclick='$.addRoadSignCollectModal()'><i class='fa fa-plus-square'></i> 添加</button></li>";
            // gInsert == 0 ? strToolBar : strToolBar += buttonAdd;

            var buttonDelete = "<li><button href='#' class='btn btn-primary btn-sm btn-flat btn-block' " +
                "onclick='$.deleteRoadSignCollect(0)'><i class='fa fa-minus-square'></i> 删除</button></li>";

            strToolBar += "</ul></div>";
            $("#modalToolbar").append(strToolBar);
        },
        processing: true,
        serverSide: true,
        ordering: false,
        select: false,
        autoFill: true,
        bDestroy: true,
        displayLength: 20,
        lengthMenu: [[5, 10, 15, 20, 50, 100, 150, -1], [5, 10, 15, 20, 50, 100, 150, "All"]],
        language: {
            url: "zh_cn.json"
        },
        fnDrawCallback: function () {// 序号自增回调函数
            var api = this.api();
            var startIndex = api.context[0]._iDisplayStart;
            api.column(0).nodes().each(function (cell, i) {
                cell.innerHTML = startIndex + i + 1;
            });
        }
    });
    $("#getRoadSignByRoadPoleIdLabel").text("标牌信息");
    $("#getRoadSignByRoadPoleIdModal").modal({
        backdrop: 'static',
        keyboard: false,
        show: true
    });
    if (jsonData.roadPoleIsComplete == 0 && auditStatus == 0) {
        $("#modalAudit").show();
    }
    else
        $("#modalAudit").hide();
};

$.closeModal = function () {
    $("#batchCheckModal").prop('checked', false);
    $('#getRoadSignByRoadPoleIdModal').modal('hide');
};

$.checkChangeModal = function () {
    var isChecked = $("#batchCheckModal").prop('checked');
    $("input:checkbox[id^='modalCheckbox']").prop("checked", isChecked);
};

$.updateRoadSignCollectModal = function (jsonData) {
    switchPic = 2;
    roadSignCollectFlag = 0;
    $("#roadSignLightModalDiv").insertAfter($("#roadSignFixedModalDiv"));
    $("#roadSignQrcodeModalDiv").show();
    $("#roadSignIdModal").val(jsonData.roadSignId);
    $("#roadSignTypeModal").val(jsonData.roadSignType);
    $("#roadSignBugModal").val(jsonData.roadSignBug);
    $("#roadSignSecurityModal").val(jsonData.roadSignSecurity);
    $("#roadSignShapeModal").val(jsonData.roadSignShape);
    $("#roadSignDirectionModal").val(jsonData.roadSignDirection);
    $("#roadSignMaterialModal").val(jsonData.roadSignMaterial);
    $("#roadSignInstallTypeModal").val(jsonData.roadSignInstallType);
    $("#roadSignFixedModal").val(jsonData.roadSignFixed);
    $("#roadSignLightModal").val(jsonData.roadSignLight);
    $("#roadSignPicModal").attr("src", jsonData.roadSignPic);
    $("#roadSignQrcodeModal").attr("src", jsonData.roadSignQrcode);
    $("#defectsLiabilityPeriodModal").val(jsonData.defectsLiabilityPeriod);
    $("#serviceLifeModal").val(jsonData.serviceLife);
    $("#environmentModal").val(jsonData.environment);
    $("#roadSignRemarkModal").val(jsonData.roadSignRemark);
    $("#installOrgModal").val(jsonData.installOrg);
    $("#roadSignInstallTimeModal").val(jsonData.roadSignInstallTime);
    $("#createUserNameModal").val(jsonData.userName);
    $("#installOrgModal").val(jsonData.installOrg);
    $("#roadSignInstallTimeModal").val(jsonData.roadSignInstallTime);
    fileUrl = $("#roadSignPicModal").attr("src");
    $.changeRoadSignTypeModal(jsonData.roadSignMeaning);
    $("#roadSignSizeModal").val(jsonData.roadSignSize);
    $("#roadSignCollectLabel").text("查看标牌信息");
    $("#roadSignCollectModal").modal({
        backdrop: 'static',
        keyboard: false,
        show: true
    });
};

$("#roadSignPicModal").click(function () {
    $.showPicModal($(this).attr("src"));
});

$.addRoadSignCollectModal = function () {
    switchPic = 2;
    roadSignCollectFlag = 1;
    $("#roadSignLightModalDiv").insertAfter($("#roadSignPicModalDiv"));
    $("#roadSignQrcodeModalDiv").hide();
    $("#roadSignIdModal").val(0);
    $("#createUserIdModal").val(gUserLoginResult.userId);
    $("#orgIdModal").val(gUserLoginResult.orgId);
    $("#roadPoleIdModal").val(roadPoleJsonData.roadPoleId);
    $("#mainOrgIdModal").val(roadPoleJsonData.mainOrgId);
    $("#roadSignTypeModal").val(0);
    $("#roadSignBugModal").val(0);
    $("#roadSignSecurityModal").val(0);
    $("#roadSignShapeModal").val(0);
    $("#roadSignDirectionModal").val(0);
    $("#roadSignMaterialModal").val(0);
    $("#roadSignInstallTypeModal").val(0);
    $("#roadSignFixedModal").val(0);
    $("#roadSignLightModal").val(0);
    $("#roadSignPicModal").attr("src", "../images/default_photo.png");
    $("#roadSignQrcodeModal").attr("src", "");
    $("#defectsLiabilityPeriodModal").val(1);
    $("#serviceLifeModal").val(1);
    $("#environmentModal").val(0);
    $("#roadSignRemarkModal").val("");
    $("#createUserNameModal").val(gUserLoginResult.userName);
    $.changeRoadSignTypeModal(1);
    $.changeRoadSignShapeModal(0);
    $("#roadSignCollectLabel").text("添加标牌信息");
    $("#roadSignCollectModal").modal({
        backdrop: 'static',
        keyboard: false,
        show: true
    });
};

$.changeRoadSignTypeModal = function (roadSignMeaning) {
    var i;
    $("#roadSignMeaningModal").empty();
    switch ($("#roadSignTypeModal").val()) {
        case '0':
            for (i = 1; i <= 47; i++)
                $("#roadSignMeaningModal").append("<option value='" + i + "'>警 " + i + "</option>");
            break;
        case '1':
            for (i = 1; i <= 48; i++)
                $("#roadSignMeaningModal").append("<option value='" + i + "'>禁 " + i + "</option>");
            break;
        case '2':
            for (i = 1; i <= 36; i++)
                $("#roadSignMeaningModal").append("<option value='" + i + "'>示 " + i + "</option>");
            break;
        case '3':
            for (i = 1; i <= 79; i++)
                $("#roadSignMeaningModal").append("<option value='" + i + "'>路 " + i + "</option>");
            break;
        case '4':
            for (i = 1; i <= 17; i++)
                $("#roadSignMeaningModal").append("<option value='" + i + "'>旅 " + i + "</option>");
            break;
        case '5':
            for (i = 1; i <= 22; i++)
                $("#roadSignMeaningModal").append("<option value='" + i + "'>辅 " + i + "</option>");
            break;
        case '6':
            for (i = 1; i <= 48; i++)
                $("#roadSignMeaningModal").append("<option value='" + i + "'>作 " + i + "</option>");
            break;
        case '7':
            $("#roadSignMeaningModal").append("<option value='1'>无</option>");
            break;
    }
    $("#roadSignMeaningModal").val(roadSignMeaning);
};

$("#roadSignTypeModal").change(function () {
    $.changeRoadSignTypeModal(1);
});


$("#roadSignShapeModal").change(function () {
    $.changeRoadSignShapeModal(0);
});

$('#roadSignCollectForm').bootstrapValidator({
    feedbackIcons: {
        valid: 'glyphicon glyphicon-ok',
        invalid: 'glyphicon glyphicon-remove',
        validating: 'glyphicon glyphicon-refresh'
    },
    fields: {
        roadSignType: {
            validators: {
                notEmpty: {message: '标志分类不能为空'}
            }
        },
        roadSignMeaning: {
            validators: {
                notEmpty: {message: '标志含义不能为空'}
            }
        },
        roadSignBug: {
            validators: {
                notEmpty: {message: '存在问题不能为空'}
            }
        },
        roadSignSecurity: {
            validators: {
                notEmpty: {message: '安全状况不能为空'}
            }
        },
        roadSignShape: {
            validators: {
                notEmpty: {message: '标志形状不能为空'}
            }
        },
        roadSignSize: {
            validators: {
                notEmpty: {message: '标牌尺寸不能为空'}
            }
        },
        roadSignMaterial: {
            validators: {
                notEmpty: {message: '标志材料不能为空'}
            }
        },
        roadSignDirection: {
            validators: {
                notEmpty: {message: '标志朝向不能为空'}
            }
        },
        roadSignInstallType: {
            validators: {
                notEmpty: {message: '安装方式不能为空'}
            }
        },
        roadSignFixed: {
            validators: {
                notEmpty: {message: '固定方式不能为空'}
            }
        },
        roadSignLight: {
            validators: {
                notEmpty: {message: '光源显示不能为空'}
            }
        },
        defectsLiabilityPeriod: {
            validators: {
                notEmpty: {message: '保修期不能为空'}
            }
        },
        serviceLife: {
            validators: {
                notEmpty: {message: '使用年限不能为空'}
            }
        },
        environment: {
            validators: {
                notEmpty: {message: '使用场景不能为空'}
            }
        },
        roadSignRemark: {
            validators: {
                stringLength: {max: 200, message: '备注长度不超过200'}
            }
        }
    }
}).on('success.form.bv', function (e) {
    e.preventDefault();
    $("#roadSignPic").val(fileUrl);
    var $form = $(e.target);
    var url = "../rds_roadSignManageController/updateRoadSignCollect";
    if (roadSignCollectFlag == 1)
        url = "../rds_roadSignManageController/addRoadSignCollect";
    $.ajax({
        url: url,
        type: 'post',
        data: $form.serialize(),
        dataType: 'json',
        success: function (msg) {
            if (msg != null && typeof (msg) != "undefined") {
                if (msg.isSuccess == true) {
                    $.alert("数据操作成功", 1);
                    modalDT.ajax.reload(null, false);
                } else {
                    $.alert("数据操作失败", 2);
                }
            } else {
                $.alert('系统错误，请联系管理员', 2);
            }
        },
        error: function () {
            $.alert('系统错误，请联系管理员', 2);
        }
    });
    $.clearModal($("#roadSignCollectForm"), $("#roadSignCollectModal"));
});

$.deleteRoadSignCollect = function (roadSignIds) {
    var count = 1;
    if (roadSignIds == 0) {
        count = $("input:checkbox[id^='modalCheckbox']:checked").length;
        if (count == 0) {
            $.alert("请选择要删除的数据", 2);
            return;
        } else {
            roadSignIds = "";
            $("input:checkbox[id^='modalCheckbox']:checked").each(function () {
                roadSignIds += $(this).val() + ",";
            });
            roadSignIds = roadSignIds.substring(0, roadSignIds.length - 1);
        }
    }
    bootbox.confirm({
        buttons: {
            confirm: {
                label: '<i class="fa fa-check"></i> 确定',
                className: 'btn btn-primary btn-flat'
            },
            cancel: {
                label: '<i class="fa fa-close"></i> 取消',
                className: 'btn btn-warning btn-flat pull-left'
            }
        },
        message: '<i class="fa fa-question-circle-o"></i> <b class="customer-title">确定删除该' + count + '条数据吗?</b>',
        callback: function (result) {
            if (result) {
                $.ajax({
                    url: '../rds_roadSignManageController/deleteRoadSignCollect',
                    type: 'post',
                    dataType: 'json',
                    data: {
                        "roadSignIds": roadSignIds
                    },
                    success: function (msg) {
                        if (msg != null && typeof (msg) != "undefined") {
                            if (msg.isSuccess == true) {
                                $.alert("数据删除成功", 1);
                                modalDT.ajax.reload(null, false);
                            } else {
                                $.alert("数据删除失败", 2);
                            }
                        } else {
                            $.alert('系统错误，请联系管理员', 2);
                        }
                    },
                    error: function () {
                        $.alert('系统错误，请联系管理员', 2);
                    }
                });
            }
        }
    });
};

$.roadSignAudit = function (data) {
    bootbox.confirm({
        buttons: {
            confirm: {
                label: '<i class="fa fa-check"></i> 确定',
                className: 'btn btn-primary btn-flat'
            },
            cancel: {
                label: '<i class="fa fa-close"></i> 取消',
                className: 'btn btn-warning btn-flat pull-left'
            }
        },
        message: '<i class="fa fa-question-circle-o"></i> <b class="customer-title">确定执行该操作?</b>',
        callback: function (data) {
            if (data > 0) {
                $.ajax({
                    url: '../rds_roadSignAudit/auditRoadPole',
                    type: 'POST',
                    dataType: 'json',
                    data: {
                        roadPoleIds: Number(ggRoadPoleId),
                        flag: Number(data)
                    },
                    success: function (msg) {
                        if (msg != null && typeof (msg) != "undefined") {
                            if (msg.isSuccess == true) {
                                $.alert("数据操作成功", 1);
                                $.closeShowModal();
                            } else {
                                $.alert("数据操作失败", 2);
                            }
                        } else {
                            $.alert('系统错误，请联系管理员', 2);
                        }
                    },
                    error: function () {
                        $.alert('系统错误，请联系管理员', 2);
                    }
                });
            }
        }
    });
};

// 关闭showInfoModal
$.closeShowModal = function () {
    $("#getRoadSignByRoadPoleIdModal").modal("hide");
    gMainDT.ajax.reload(null, false);
};

// 打开上传modal框
$.openUpPic = function () {
    $("#upPictureModal").modal({
        backdrop: 'static',
        keyboard: true,
        show: true
    });
};

// 关闭上传modal框
$.closeUpPhModal = function () {
    $("#upPictureModal").modal("hide");
    $("#ossfile").empty();
    clearOssData();
};

//获取图片信息
$.doneUpPhoto = function () {
    var fileInfo = getOssFileInfo();
    fileUrl = fileInfo[0].fileUrl;
    switch (switchPic) {
        case 0:
            $("#roadPolePicUpdate").attr("src", fileUrl);
            break;
        case 1:
            $("#roadPolePicAdd").attr("src", fileUrl);
            break;
        case 2:
            $("#roadSignPicModal").attr("src", fileUrl);
            break;
    }
    $.closeUpPhModal();
};

//判断文件类型(在需要的js文件添加，文件名务必保持一致)
function judgeFileType(suffix) {
    //图片文件
    if (!(suffix == ".jpg" || suffix == ".JPG" || suffix == ".png" || suffix == ".PNG" ||
        suffix == ".jpeg" || suffix == ".JPEG" || suffix == ".gif" || suffix == ".GIF" ||
        suffix == ".bmp" || suffix == ".BMP")) {
        alert("请选择图片文件！");
        return false;
    }
}

$.RoadPoleAudit = function (roadPoleId) {
    var count = 1;
    if (roadPoleId == 0) {
        count = $("input:checkbox[id^='checkbox']:checked").length;
        if (count == 0) {
            $.alert("请选择要审核的数据", 2);
            return;
        } else {
            roadPoleId = "";
            $("input:checkbox[id^='checkbox']:checked").each(function () {
                roadPoleId += $(this).val() + ",";
            });
            console.log(roadPoleId)
            roadPoleId = roadPoleId.substring(0, roadPoleId.length - 1);
            console.log(123123123)
            console.log(roadPoleId)
        }
    }
    bootbox.confirm({
        buttons: {
            confirm: {
                label: '<i class="fa fa-check"></i> 确定',
                className: 'btn btn-primary btn-flat'
            },
            cancel: {
                label: '<i class="fa fa-close"></i> 取消',
                className: 'btn btn-warning btn-flat pull-left'
            }
        },
        message: '<i class="fa fa-question-circle-o"></i> <b class="customer-title">确定审核该' + count + '条数据吗?</b>',
        callback: function (result) {
            if (result) {
                $.ajax({
                    url: '../rds_roadSignAudit/auditRoadPoleSign',
                    type: 'post',
                    dataType: 'json',
                    data: {
                        "roadPoleId": roadPoleId
                    },
                    success: function (msg) {
                        if (msg != null && typeof (msg) != "undefined") {
                            if (msg.isSuccess == true) {
                                $.alert("数据操作成功", 1);
                                gMainDT.ajax.reload(null, false);
                            } else {
                                $.alert("数据操作失败", 2);
                            }
                        } else {
                            $.alert('系统错误，请联系管理员', 2);
                        }
                    },
                    error: function () {
                        $.alert('系统错误，请联系管理员', 2);
                    }
                });
            }
        }
    });
}
//地图
$.myBtnMap = function () {
    var coordinate = $("#coordinate").val().split(",");
    var url = "fault/roadPoleAuditMap.html";
    url += "?x=" + coordinate[0] + "&y=" + coordinate[1] + "&z=1";//通过这种方式传参数
    $("#myMap").attr("src", url);
    $("#modal-map").modal({
        backdrop: 'static',
        keyboard: false,
        show: true
    })
}
//预览modal
$.getAllInformation = function (jsonData) {
    $("#myDiv").empty();
    $("#address").html(jsonData.province + " " + jsonData.city + " " + jsonData.area + " " + jsonData.roadName + " " + jsonData.startRoad + "起 " + jsonData.endRoad + "止");
    var temp;
    if (jsonData.roadPoleShape == 0)
        temp = "单直杆";
    if (jsonData.roadPoleShape == 1)
        temp = "双直杆";
    if (jsonData.roadPoleShape == 2)
        temp = "单挑杆";
    if (jsonData.roadPoleShape == 3)
        temp = "双挑杆";
    if (jsonData.roadPoleShape == 4)
        temp = "二F杆";
    if (jsonData.roadPoleShape == 5)
        temp = "三F杆";
    if (jsonData.roadPoleShape == 6)
        temp = "门架";
    $("#shape").html(temp);
    if (jsonData.roadPoleSecurity == 0)
        temp = "安全";
    if (jsonData.roadPoleSecurity == 1)
        temp = "不安全";
    $("#security").html(temp);
    if (jsonData.roadPoleBridge == 0)
        temp = "否";
    if (jsonData.roadPoleBridge == 1)
        temp = "是";
    $("#bridge").html(temp);
    $("#projectNo").html("<b>项目编号:</b>"+jsonData.projectNumber);
    $("#create").html(jsonData.userName);
    $("#size").html(jsonData.roadPoleSize);
    $("#company").html(jsonData.orgName);
    $("#mainOrg").html(jsonData.mainOrgName);
    $.ajax({
        url: "../rds_roadSignManageController/getRoadSignCollect",
        type: 'post',
        async: false,
        dataType: 'json',
        data: {
            'roadPoleId': jsonData.roadPoleId
        },
        success: function (msg) {
            if (msg != null && typeof (msg) != "undefined") {
                if (msg.isSuccess == true) {
                    var Data = msg.jsonData;
                    for (var i = 0; i < Data.length; i++) {
                        var data = Data[i];
                        var roadSignLight;
                        var roadSignShape;
                        var roadSignInstallType;
                        var roadSignMaterial;
                        var roadSignDirection;
                        var roadSignType;
                        var roadSignBug;
                        var roadSignSize=data.roadSignSize;
                        var environment = "日常使用";
                        if (data.environment == 1)
                            environment = "施工配合";
                        var roadSignFixed = "扎带";
                        if (data.roadSignFixed == 1)
                            roadSignFixed = "抱箍";
                        var roadSignSecurity = "安全";
                        if (data.roadSignSecurity != 0) {
                            roadSignSecurity = "不安全";
                        }

                        switch (data.roadSignInstallType) {
                            case 0:
                                roadSignInstallType = "单标志";
                                break;
                            case 1:
                                roadSignInstallType = "合杆";
                                break;
                            case 2:
                                roadSignInstallType = "借杆";
                                break;
                        }
                        switch (data.roadSignLight) {
                            case 0:
                                roadSignLight = "反光";
                                break;
                            case 1:
                                roadSignLight = "发光";
                                break;
                            case 2:
                                roadSignLight = "照明";
                                break;
                        }
                        switch (data.roadSignMaterial) {
                            case 0:
                                roadSignMaterial = "铝板";
                                break;
                            case 1:
                                roadSignMaterial = "塑料板";
                                break;
                            case 2:
                                roadSignMaterial = "其他";
                                break;

                        }
                        switch (data.roadSignShape) {
                            case 0: {
                                roadSignShape = "圆形";
                                break;
                            }
                            case 1: {
                                roadSignShape = "八角形";
                                break;
                            }
                            case 2: {
                                roadSignShape = "正三角";
                                break;
                            }
                            case 3: {
                                roadSignShape = "倒三角";
                                break;
                            }
                            case 4: {
                                roadSignShape = "矩形";
                                break;
                            }
                            case 5: {
                                roadSignShape = "方形";
                                break;
                            }
                        }
                        switch (data.roadSignDirection) {
                            case 0:
                                roadSignDirection = "东";
                                break;
                            case 1:
                                roadSignDirection = "南";
                                break;
                            case 2:
                                roadSignDirection = "西";
                                break;
                            case 3:
                                roadSignDirection = "北";
                                break;
                        }
                        switch (data.roadSignType) {
                            case 0:
                                roadSignType = "警告标志";
                                break;
                            case 1:
                                roadSignType = "禁令标志";
                                break;
                            case 2:
                                roadSignType = "指示标志";
                                break;
                            case 3:
                                roadSignType = "指路标志";
                                break;
                            case 4:
                                roadSignType = "旅游标志";
                                break;
                            case 5:
                                roadSignType = "辅助标志";
                                break;
                            case 6:
                                roadSignType = "作业标志";
                                break;
                            case 7:
                                roadSignType = "告示标志";
                                break;
                        }
                        switch (data.roadSignBug) {
                            case 0:
                                roadSignBug = "正常";
                                break;
                            case 1:
                                roadSignBug = "膜脱落";
                                break;
                            case 2:
                                roadSignBug = "膜淡化";
                                break;
                            case 3:
                                roadSignBug = "逆反射系数不达标";
                                break;
                            case 4:
                                roadSignBug = "卷边";
                                break;
                            case 5:
                                roadSignBug = "转向";
                                break;
                            case 6:
                                roadSignBug = "非国际";
                                break;
                            case 7:
                                roadSignBug = "抱箍缺少";
                                break;
                            case 8:
                                roadSignBug = "净空高不达标";
                                break;
                            case 9:
                                roadSignBug = "设置不合理";
                                break;
                            case 10:
                                roadSignBug = "缺失";
                                break;
                            case 11:
                                roadSignBug = "建议增设";
                                break;
                            case 12:
                                roadSignBug = "与交通组织矛盾";
                                break;
                            case 13:
                                roadSignBug = "内容有误";
                                break;
                            case 14:
                                roadSignBug = "标牌与标杆不配套";
                                break;
                            case 15:
                                roadSignBug = "非公指示牌";
                                break;
                        }
                        var n = i + 1;
                        var html = "<table class=\"table table-bordered table-striped\">\n" +
                            "                        <tr>\n" +
                            "                            <th><b>标牌" + n + "</b><th>";
                        if (data.roadSignIsComplete == 0) {
                            html += "                            <th><button type='button' class='btn btn-danger btn-xs btn-flat' >" +
                                "未审核</button><th>";
                        } else {
                            html += "                            <th><button type='button' class='btn btn-default btn-xs btn-flat' >" +
                                "已审核</button><th>";
                        }
                        html += "                        </tr>\n" +
                            "                        <tr>\n" +
                            "                            <td  rowspan=\"8\" colspan=\"3\"><img  onclick=\"$.showPicModal('" + data.roadSignPic + "')\" style=\"width: 230px;height:270px;\" src=\"" + data.roadSignPic + "\"></td>\n" +
                            "                            <td><b>标志分类：</b></td>\n" +
                            "                            <td>" + roadSignType + "</td>\n" +
                            "                            <td><b>标志含义:</b></td>\n" +
                            "                            <td>" + roadSignType.substring(0, 1) + "" + data.roadSignMeaning + "</td>\n" +
                            "                        </tr>\n" +
                            "                        <tr>\n" +
                            "                            <td><b>存在问题:</b></td>\n" +
                            "                            <td>" + roadSignBug + "</td>\n" +
                            "                            <td><b>安全状况:</b></td>\n" +
                            "                            <td>" + roadSignSecurity + "</td>\n" +
                            "                        </tr>\n" +
                            "                        <tr>\n" +
                            "                            <td><b>标志形状:</b></td>\n" +
                            "                            <td>" + roadSignShape + "</td>\n" +
                            "                            <td><b>标牌尺寸:</b></td>\n" +
                            "                            <td>" + roadSignSize + "</td>\n" +
                            "\n" +
                            "                        </tr>\n" +
                            "                        <tr>\n" +
                            "                            <td><b>标志材料:</b></td>\n" +
                            "                            <td>" + roadSignMaterial + "</td>\n" +
                            "                            <td><b>采集人 :</b></td>\n" +
                            "                            <td>" + data.userName + "</td>\n" +
                            "\n" +
                            "                        </tr>\n" +
                            "                        <tr>\n" +
                            "                            <td><b>光源显示:</b></td>\n" +
                            "                            <td>" + roadSignLight + "</td>\n" +
                            "                            <td><b>安装方式:</b></td>\n" +
                            "                            <td>" + roadSignInstallType + "</td>\n" +
                            "\n" +
                            "                        </tr>\n" +
                            "                        <tr>\n" +
                            "                            <td><b>固定方式:</b></td>\n" +
                            "                            <td>" + roadSignFixed + "</td>\n" +
                            "                            <td><b>安装日期:</b></td>\n" +
                            "                            <td>" + data.roadSignInstallTime + "</td>\n" +
                            "\n" +
                            "                        </tr>\n" +
                            "                        <tr>\n" +
                            "                            <td><b>安装公司:</b></td>\n" +
                            "                            <td>" + data.installOrg + "</td>\n" +
                            "                            <td><b>使用场景:</b></td>\n" +
                            "                            <td>" + environment + "</td>\n" +
                            "                        </tr>\n" +
                            "                        <tr>\n" +
                            "                            <td><b>保修期 :</b></td>\n" +
                            "                            <td>" + data.defectsLiabilityPeriod + "年</td>\n" +
                            "                            <td><b>使用年限:</b></td>\n" +
                            "                            <td>" + data.serviceLife + "年</td>\n" +
                            "                        </tr>\n" +
                            "                        <tr>\n" +
                            "                            <td><b>标志朝向:</b></td>\n" +
                            "                            <td>" + roadSignDirection + "</td>\n" +
                            "                            <td><b>备注说明:</b></td>\n" +
                            "                            <td colspan=\"7\">" + data.roadSignRemark + "</td>\n" +
                            "                        </tr>\n" +
                            "                        <tr>\n" +
                            "                        </table>";
                        $("#myDiv").append(html);
                    }
                } else {
                    $.alert("数据操作失败", 2);
                }
            } else {
                $.alert('系统错误，请联系管理员', 2);
            }
        }
    });


    $("#img").attr("src", jsonData.roadPolePic);
    $("#img").click(function () {
        $.showPicModal($(this).attr("src"));
    });
    $("#modal-AllInformation").modal({
        backdrop: 'static',
        keyboard: false,
        show: true
    });
};

//标牌审核
$.roadSignAuditById = function (data) {
    var roadSignId = data.roadSignId;
    bootbox.confirm({
        buttons: {
            confirm: {
                label: '<i class="fa fa-check"></i> 确定',
                className: 'btn btn-primary btn-flat'
            },
            cancel: {
                label: '<i class="fa fa-close"></i> 取消',
                className: 'btn btn-warning btn-flat pull-left'
            }
        },
        message: '<i class="fa fa-question-circle-o"></i> <b class="customer-title">确定审核通过该标牌?</b>',
        callback: function (data) {
            if (data > 0) {
                $.ajax({
                    url: '../rds_roadSignAudit/auditRoadSign',
                    type: 'POST',
                    dataType: 'json',
                    data: {
                        roadSignId: roadSignId
                    },
                    success: function (msg) {
                        if (msg != null && typeof (msg) != "undefined") {
                            if (msg.isSuccess == true) {
                                $.alert("数据操作成功", 1);
                                modalDT.ajax.reload(null, false);
                            } else {
                                $.alert("数据操作失败", 2);
                            }
                        } else {
                            $.alert('系统错误，请联系管理员', 2);
                        }
                    },
                    error: function () {
                        $.alert('系统错误，请联系管理员', 2);
                    }
                });
            }
        }
    });
};